package com.sgb.kjwl.view.ui.fragment.enterprise;

import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.google.android.material.tabs.TabLayout;
import com.sgb.kjwl.AppLazyFragment;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.FragmentProfessoonalQuoteBinding;
import com.sgb.kjwl.di.enterprise.DaggerEnterpriseFragComponent;
import com.sgb.kjwl.di.enterprise.EnterpriseFragModule;
import com.sgb.kjwl.model.entity.ParentAreaEntity;
import com.sgb.kjwl.model.entity.enterprise.EpQuoteEntity;
import com.sgb.kjwl.model.entity.enterprise.IpPickSelectEntity;
import com.sgb.kjwl.model.entity.enterprise.SecerTitleEntity;
import com.sgb.kjwl.model.entity.transport.GoodsSourceLocationEntity;
import com.sgb.kjwl.model.entity.user.AddressEntity;
import com.sgb.kjwl.utils.ActivityJump;
import com.sgb.kjwl.utils.DialogFunction;
import com.sgb.kjwl.utils.DialogHelper;
import com.sgb.kjwl.utils.PickPriceUtils;
import com.swgk.core.event.EventConstant;
import com.sgb.kjwl.view.event.LoginEvent;
import com.sgb.kjwl.view.event.SearchEvent;
import com.sgb.kjwl.view.ui.activity.enterprise.ProfessionalQuoteDetailActivity;
import com.sgb.kjwl.view.ui.adapter.enterprise.EpQuoteAdapter;
import com.sgb.kjwl.view.widget.IpPopWindow;
import com.sgb.kjwl.view.widget.ServiceCityPopWindow;
import com.sgb.kjwl.view.widget.ThreeLevelAreaWindow;
import com.sgb.kjwl.viewmodel.enterprise.ProfessionalQuoteFrgModel;
import com.swgk.core.base.di.AppComponent;
import com.swgk.core.recyclerview.adapter.AdapterOnItemClick;
import com.swgk.core.xrecyclerview.XRecyclerView;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.inject.Inject;

public class ProfessionalQuoteFragment extends AppLazyFragment {

    @Inject
    ProfessionalQuoteFrgModel viewModel;
    private FragmentProfessoonalQuoteBinding binding;
    private EpQuoteAdapter epQuoteAdapter;

//    private ServicePopWindow servicePopWindow;
    private ServiceCityPopWindow cityPopWindow2;
    private List<ParentAreaEntity<List<ParentAreaEntity>>> listService;
    private String serviceClass;
    private List<AddressEntity<List<AddressEntity<List<AddressEntity>>>>> cityDatas;
    private String parentNo = "";
    private String childNo = "";
    private boolean isChange2;
    private boolean isChange1;
    private boolean isChange3;
    private boolean isChange4;
    private Map<String, Object> map;
    private ThreeLevelAreaWindow mAddressPop;



    private IpPopWindow teamForEnterpisePopWindow_price;
    private IpPopWindow teamForEnterpisePopWindow_sendtype;
    private List<IpPickSelectEntity> priceDatas = new ArrayList<>();
    private List<IpPickSelectEntity> publishTypeDatas = new ArrayList<>();
    //首页选中的服务分类
    private SecerTitleEntity choice_entry;
    private int index_tab_one = 0;
    private int index_tab_tow = 0;

    public static ProfessionalQuoteFragment newInstance(List<ParentAreaEntity<List<ParentAreaEntity>>> list, String serviceClass) {
        ProfessionalQuoteFragment fragment = new ProfessionalQuoteFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable("list", (Serializable) list);
        bundle.putString("serviceClass", serviceClass);
        fragment.setArguments(bundle);
        return fragment;
    }


    /**
     *
     * @param list  二三级分类
     * @param serviceClass 一级分类id
     * @param websiteNo no
     * @param websiteType 用户类型  用于赛选个人企业团队网站的企业经营
     * @return
     */
    public static ProfessionalQuoteFragment newInstance(List<ParentAreaEntity<List<ParentAreaEntity>>> list, String serviceClass,String websiteNo, String websiteType) {
        ProfessionalQuoteFragment fragment = new ProfessionalQuoteFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable("list", (Serializable) list);
        bundle.putString("serviceClass", serviceClass);
        bundle.putString("websiteNo",websiteNo);
        bundle.putString("websiteType",websiteType);
        fragment.setArguments(bundle);
        return fragment;
    }


    public static ProfessionalQuoteFragment newInstance(List<ParentAreaEntity<List<ParentAreaEntity>>> list, String serviceClass, SecerTitleEntity entity) {
        ProfessionalQuoteFragment fragment = new ProfessionalQuoteFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable("list", (Serializable) list);
        bundle.putSerializable("entity", (Serializable) entity);
        bundle.putString("serviceClass", serviceClass);
        fragment.setArguments(bundle);
        return fragment;
    }


    @Override
    protected void setupFragmentComponent(AppComponent appComponent) {
        DaggerEnterpriseFragComponent.builder()
                .appComponent(appComponent)
                .enterpriseFragModule(new EnterpriseFragModule(this))
                .build()
                .inject(this);
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        binding = DataBindingUtil.inflate(inflater, R.layout.fragment_professoonal_quote, container, false);
        binding.setViewModel(viewModel);
        return binding.getRoot();
    }



    @Override
    protected void initView() {
        super.initView();
        listService = (List<ParentAreaEntity<List<ParentAreaEntity>>>) getArguments().getSerializable("list");
        serviceClass = (String) getArguments().getSerializable("serviceClass");
        choice_entry = (SecerTitleEntity) getArguments().getSerializable("entity");
        viewModel.websiteNo = getArguments().getString("websiteNo");
        viewModel.websiteType = getArguments().getString("websiteType");

        if(!TextUtils.isEmpty(viewModel.websiteNo)&&!TextUtils.isEmpty(viewModel.websiteType)){
            binding.rlSendtype.setVisibility(View.GONE);
        }else{
            binding.rlSendtype.setVisibility(View.VISIBLE);
        }

        if (!EventBus.getDefault().isRegistered(this)) {
            EventBus.getDefault().register(this);
        }

        map = new HashMap<>();
        binding.rlCategory.setOnClickListener(this);
        binding.rlCity.setOnClickListener(this);
        binding.rlPrice.setOnClickListener(this);
        binding.rlSendtype.setOnClickListener(this);
        binding.displayView.setLayoutManager(new LinearLayoutManager(getActivity()));
        epQuoteAdapter = new EpQuoteAdapter(getActivity(), null, false);
        binding.displayView.setAdapter(epQuoteAdapter);
        binding.displayView.setLoadingListener(new XRecyclerView.LoadingListener() {
            @Override
            public void onRefresh() {
                viewModel.getProfessQuoteList(false, map);
                binding.displayView.refreshComplete();
            }

            @Override
            public void onLoadMore() {
                viewModel.getProfessQuoteList(true, map);
                binding.displayView.loadMoreComplete();

            }
        });

        epQuoteAdapter.setOnItemClick(new AdapterOnItemClick<EpQuoteEntity>() {
            @Override
            public void onItemClick(EpQuoteEntity epQuoteEntity, int position) {

                ProfessionalQuoteDetailActivity.start(getActivity(), Long.parseLong(epQuoteEntity.getId()));
            }
        });
        epQuoteAdapter.OnCallPhone((num, name) -> {
            if (DialogHelper.checkLogin()) {
                DialogHelper.showDialog(getActivity(), "确认呼叫", name + ":" + num, "确定", new DialogFunction() {
                    @Override
                    public void normalRoundDialog() {
                        ActivityJump.jumpToPhone(getActivity(), num);
                    }
                });
            } else {
                DialogHelper.showLoginDialogNew(getContext(), EventConstant.EVENT_PROFESSIONAL_QUOTE_FRG_JUMP, "温馨提示", "登录后可拨打电话,去登录", "登录");
            }
        });


        if (listService == null||listService.size()==0) {
            listService = new ArrayList<>();
            binding.tabLayout1.setVisibility(View.GONE);
            binding.lin1.setVisibility(View.GONE);
        }else {
            ParentAreaEntity parentAreaEntity = new ParentAreaEntity();
            parentAreaEntity.setName("全部");
            parentAreaEntity.setId("");

            for (int i = 0; i < listService.size(); i++) {
                if (listService.get(i).getChildren() != null&&listService.get(i).getChildren().size()>0) {
                    listService.get(i).getChildren().add(0, parentAreaEntity);
                }
            }
            listService.add(0, parentAreaEntity);
            binding.tabLayout1.setVisibility(View.VISIBLE);
            for (int i = 0; i < listService.size(); i++) {
                TabLayout.Tab tab1 = binding.tabLayout1.newTab().setText(listService.get(i).getName()).setTag(i);

                if(choice_entry!=null){
                    if((choice_entry.getCategorySecondId()+"").equals(listService.get(i).getId())){
                        index_tab_one = i;
                        parentNo  = listService.get(index_tab_one).getId();
//                        tab1.select();
                        if(listService.get(i).getChildren()!=null&&listService.get(i).getChildren().size()>0){
                            binding.tabLayout2.setVisibility(View.VISIBLE);
                            binding.lin2.setVisibility(View.VISIBLE);
                            for (int i1 = 0; i1 < listService.get(i).getChildren().size(); i1++) {

                                TabLayout.Tab tab = binding.tabLayout2.newTab().setText(listService.get(i).getChildren().get(i1).getName()).setTag(i1);
                                if((choice_entry.getCategoryThirdId()+"").equals(listService.get(i).getChildren().get(i1).getId())){
                                    index_tab_tow = i1;
                                    childNo = listService.get(i).getChildren().get(i1).getId();
//                                    tab.select();
                                }
                                binding.tabLayout2.addTab(tab);
                            }
                        }else{
                            binding.tabLayout2.setVisibility(View.GONE);
                            binding.lin2.setVisibility(View.GONE);
                        }
                    }
                }

                binding.tabLayout1.addTab(tab1);
            }
            if(index_tab_one!=0&&choice_entry!=null) {
                binding.tabLayout1.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        binding.tabLayout1.getTabAt(index_tab_one).select();

                    }
                }, 100);


            }

        }
        //城市
        cityPopWindow2 = new ServiceCityPopWindow(getActivity());
        cityPopWindow2.setBgView(binding.grayLayout);
        cityPopWindow2.setOnResultClick((key1, key2, key3) -> {
            isChange2 = !key2.equals("") || !key3.equals("不限");
            map.put("city", key2.equals("") ? key1 : key2);
            viewModel.getProfessQuoteList(false, map);
        });
        cityPopWindow2.setOnDisMissClick(() -> {
            if (isChange2) {
                binding.rlCity.contentSelectRed(true, false);
            } else {
                binding.rlCity.contentSelectRed(false, false);
            }
        });

        mAddressPop = new ThreeLevelAreaWindow(getActivity());
        mAddressPop.setMemberHeight();
        mAddressPop.setCitySingle();
        mAddressPop.setProvinceSingle();
        mAddressPop.setShowSimpleName(true);
        mAddressPop.setOnlyShowProAndCity(true);
        mAddressPop.setAllSingleSelect(true);
        mAddressPop.setThreeListIsGone(true);
        mAddressPop.setBgView(binding.grayLayout);
        mAddressPop.setOnResultClick(new ThreeLevelAreaWindow.OnResultClickProxy() {
            @Override
            protected void result(GoodsSourceLocationEntity entity) {
                if (entity.getProvinceNo() == null || entity.getProvinceNo().equals("")) {
                    isChange2 = false;
                    map.remove("city");
                    viewModel.getProfessQuoteList(false, map);
                    return;
                }
                isChange2 = (entity.getProvinceNo() != null && !entity.getProvinceNo().equals("")) || (entity.getCityNo() != null && !entity.getCityNo().equals("")) || (entity.getCityName() != null && !entity.getCityName().equals("不限"));
                map.put("city", entity.getCityNo() == null || entity.getCityNo().equals("") ? entity.getProvinceNo() : entity.getCityNo());
                viewModel.getProfessQuoteList(false, map);
            }
        });
        mAddressPop.setOnDismissListener(() -> {
            if (isChange2) {
                binding.rlCity.contentSelectRed(true, false);
            } else {
                binding.rlCity.contentSelectRed(false, false);
            }
        });

        teamForEnterpisePopWindow_price = new IpPopWindow(getActivity());
        teamForEnterpisePopWindow_price.setOnResultClick((type, key2, key3) -> {
            viewModel.getProfessQuoteList(false, PickPriceUtils.pickPrice(map, (IpPickSelectEntity) type));
            if (!((IpPickSelectEntity) type).getName().equals("不限")) {
                isChange3 = true;
                setTextViewBg(binding.rlPrice, R.drawable.search_new_blue_bg, R.mipmap.icon_down_red, R.color.color_main);
            } else {
                isChange3 = false;
                setTextViewBg(binding.rlPrice, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
                setDrwImage(binding.rlPrice, 2);
            }
        });
        teamForEnterpisePopWindow_price.setOnDismissListener(() -> {
            if (!isChange3) {
                setTextViewBg(binding.rlPrice, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
                setDrwImage(binding.rlPrice, 2);
            } else {
                setDrwImage(binding.rlPrice, 1);
            }
        });

        teamForEnterpisePopWindow_sendtype = new IpPopWindow(getActivity());
        teamForEnterpisePopWindow_sendtype.setOnResultClick((type, key2, key3) -> {
            //发布类型
            map.put("publishType", ((IpPickSelectEntity) type).getPublishType());
            viewModel.getProfessQuoteList(false, map);
            if (!((IpPickSelectEntity) type).getName().equals("不限")) {
                isChange4 = true;
                setTextViewBg(binding.rlSendtype, R.drawable.search_new_blue_bg, R.mipmap.icon_down_red, R.color.color_main);
            } else {
                isChange4 = false;
                setTextViewBg(binding.rlSendtype, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
                setDrwImage(binding.rlSendtype, 2);
            }
        });
        teamForEnterpisePopWindow_sendtype.setOnDismissListener(() -> {
            if (!isChange4) {
                setTextViewBg(binding.rlSendtype, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
                setDrwImage(binding.rlSendtype, 2);
            } else {
                setDrwImage(binding.rlSendtype, 1);
            }
        });
        teamForEnterpisePopWindow_sendtype.setBgView(binding.grayLayout);
        teamForEnterpisePopWindow_price.setBgView(binding.grayLayout);
        teamForEnterpisePopWindow_price.setBackground(R.color.white);
        teamForEnterpisePopWindow_sendtype.setBackground(R.color.white);
    }

    @Override
    protected void onLazyLoad() {
        init();
        initTable();
    }


    private void initTable(){

        binding.tabLayout1.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                index_tab_one = (Integer) tab.getTag();
                parentNo  = listService.get(index_tab_one).getId();
                map.put("serviceCategory", parentNo);
                map.put("serviceItem", "");
                if(listService.get(index_tab_one).getChildren()!=null&&listService.get(index_tab_one).getChildren().size()>0){
                    binding.tabLayout2.setVisibility(View.VISIBLE);
                    binding.lin2.setVisibility(View.VISIBLE);
                    binding.tabLayout2.removeAllTabs();
                    for (int i = 0; i < listService.get(index_tab_one).getChildren().size(); i++) {
                        binding.tabLayout2.addTab(binding.tabLayout2.newTab().setText(listService.get(index_tab_one).getChildren().get(i).getName()).setTag(i));
                    }
                    if(index_tab_tow!=0){
                        binding.tabLayout2.getTabAt(index_tab_tow).select();
                        index_tab_tow = 0;
                    }

                }else{
                    childNo = "";
                    binding.tabLayout2.setVisibility(View.GONE);
                    binding.lin2.setVisibility(View.GONE);
                }
                viewModel.getProfessQuoteList(false, map);
            }
            @Override
            public void onTabUnselected(TabLayout.Tab tab) {

            }
            @Override
            public void onTabReselected(TabLayout.Tab tab) {

            }
        });

        binding.tabLayout2.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
//                index_tab_tow = (Integer)tab.getTag();
                childNo = listService.get(index_tab_one).getChildren().get((Integer)tab.getTag()).getId();
                map.put("serviceItem", childNo);
                viewModel.getProfessQuoteList(false, map);
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {

            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {

            }
        });

    }


    private void setDrwImage(TextView tv, int type) {
        Drawable img_off;
        Resources res = getResources();
        if (type == 0) {
            img_off = res.getDrawable(R.mipmap.icon_up_red);
        } else if (type == 1) {
            img_off = res.getDrawable(R.mipmap.icon_down_red);
        } else {
            img_off = res.getDrawable(R.mipmap.ic_down_arrow_n);
        }
        img_off.setBounds(0, 0, img_off.getMinimumWidth(), img_off.getMinimumHeight());
        tv.setCompoundDrawables(null, null, img_off, null); //设置右图标
    }

    private void setTextViewBg(TextView textView, int bg, int img, int textColor) {
        textView.setBackground(getResources().getDrawable(bg));
        Drawable drawable_n = getResources().getDrawable(img);
        drawable_n.setBounds(0, 0, drawable_n.getMinimumWidth(), drawable_n.getMinimumHeight());
        textView.setCompoundDrawables(null, null, drawable_n, null);
        textView.setTextColor(getResources().getColor(textColor));
    }

    private void init() {
        map.put("serviceClass", serviceClass);
        if (!TextUtils.isEmpty(parentNo)) {
            map.put("serviceCategory", parentNo);
        }
        if (!TextUtils.isEmpty(childNo)) {
            map.put("serviceItem", childNo);
        }
        if(!TextUtils.isEmpty(parentNo)) {
            map.put("serviceCategory", parentNo);
        }
        if(!TextUtils.isEmpty(childNo)) {
            map.put("serviceItem", childNo);
        }
        viewModel.getProfessQuoteList(false, map);

        List<IpPickSelectEntity> onlyDatas = new ArrayList<>();
        IpPickSelectEntity entity = new IpPickSelectEntity();
        entity.setName("不限");
        entity.setPublishType("");
        onlyDatas.add(entity);

        entity = new IpPickSelectEntity();
        entity.setName("团队");
        entity.setPublishType("2");
        onlyDatas.add(entity);

        entity = new IpPickSelectEntity();
        entity.setName("企业");
        entity.setPublishType("1");
        onlyDatas.add(entity);
        this.publishTypeDatas = onlyDatas;

    }

    /**
     * 专业报价数据
     *
     * @param list
     * @param isLoadMore
     */
    public void showQuoteList(List<EpQuoteEntity> list, boolean isLoadMore) {
        binding.displayView.refreshComplete();
        if (isLoadMore) {
            if (null != list && list.size() > 0) {
                binding.displayView.loadMoreComplete();
                epQuoteAdapter.addDatas(list);
            } else {
                binding.displayView.setNoMore(true);
            }
            binding.displayView.setVisibility(View.VISIBLE);
        } else {
            binding.displayView.refreshComplete();
            if (null != list && list.size() > 0) {
                binding.displayView.setVisibility(View.VISIBLE);
                binding.errorView.setVisibility(View.GONE);
                epQuoteAdapter.setDatas(list);
                binding.displayView.setLoadingMoreEnabled(true);
            } else {
                epQuoteAdapter.setDatas(list);
                binding.displayView.setVisibility(View.VISIBLE);
                binding.errorView.setVisibility(View.VISIBLE);
            }
        }
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()) {
            case R.id.rl_category:
//                binding.rlCategory.contentSelectRed(false, true);
//                servicePopWindow.showPopwindow(binding.roomLayout, 0, 0);
                break;
            case R.id.rl_city:
                binding.rlCity.contentSelectRed(true, true);
                if (cityDatas == null) {
                    viewModel.getServiceCity();
                } else {
                    mAddressPop.showPopwindow0(binding.roomLayout);
//                    cityPopWindow2.showPopwindow(binding.roomLayout, 0, 0);
                }
                break;

            case R.id.rl_sendtype://发布类型
                if (!isChange4) {
                    if (!teamForEnterpisePopWindow_sendtype.isShowing()) {
                        setTextViewBg(binding.rlSendtype, R.drawable.search_bg, R.mipmap.icon_down_red, R.color.color_main);
                        setDrwImage(binding.rlSendtype, 0);
                    }
                } else {
                    if (!teamForEnterpisePopWindow_sendtype.isShowing()) {
                        setDrwImage(binding.rlSendtype, 0);
                    }
                }
                if (null != publishTypeDatas && publishTypeDatas.size() > 0) {
                    teamForEnterpisePopWindow_sendtype.setData(publishTypeDatas);
                    teamForEnterpisePopWindow_sendtype.showPopwindow(binding.roomLayout, 0, 0);
                }
//                binding.rlSendtype.contentSelectRed(false, true);
//                teamForEnterpisePopWindow_sendtype.showPopwindow(binding.roomLayout, 0, 0);
                break;
            case R.id.rl_price://服务价格
                if (!isChange3) {
                    if (!teamForEnterpisePopWindow_price.isShowing()) {
                        setTextViewBg(binding.rlPrice, R.drawable.search_bg, R.mipmap.icon_down_red, R.color.color_main);
                        setDrwImage(binding.rlPrice, 0);
                    }
                } else {
                    if (!teamForEnterpisePopWindow_price.isShowing()) {
                        setDrwImage(binding.rlPrice, 0);
                    }
                }
                if (null != priceDatas && priceDatas.size() > 0) {
                    teamForEnterpisePopWindow_price.showPopwindow(binding.roomLayout, 0, 0);
                } else {
                    viewModel.getPriceOptionByNo(1);
                }
//                binding.rlPrice.contentSelectRed(false, true);
//                teamForEnterpisePopWindow_price.showPopwindow(binding.roomLayout, 0, 0);
                break;
        }
    }

    public void showMakeupPopWindow(List<IpPickSelectEntity> makeupDatas) {
        List<IpPickSelectEntity> listChange = new ArrayList<>();
        listChange = PickPriceUtils.showPriceList(makeupDatas);
        this.priceDatas = listChange;
        teamForEnterpisePopWindow_price.showPopwindow(binding.roomLayout, 0, 0);
        teamForEnterpisePopWindow_price.setData(listChange);
    }

    @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
    public void onEvent(LoginEvent event) {
        if (event.getMessageTag() == EventConstant.EVENT_PROFESSIONAL_QUOTE_FRG_JUMP) {
            viewModel.getProfessQuoteList(false, map);
        }
    }

    @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
    public void onEvent(SearchEvent event) {
        if (event.getMessageTag() == EventConstant.EVENT_SERVICE_SEARCH) {
            String searchParam = (String) event.getMessageData();
            map.put("searchParam",searchParam);
            viewModel.getProfessQuoteList(false, map);
        }
    }


    public void showCityPopWindow2(List<AddressEntity<List<AddressEntity<List<AddressEntity>>>>> cityDatas) {
        this.cityDatas = cityDatas;
        mAddressPop.setData(cityDatas, true);
        mAddressPop.showPopwindow0(binding.roomLayout);
//        cityPopWindow2.showPopwindow(binding.roomLayout, 0, 0);
//        cityPopWindow2.setData(cityDatas, false);
    }


}
